﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class sysTemp : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        databind();
        btnAdd.OnClientClick = WinADD.GetShowReference("AddClum.aspx", "新增栏目");
    }
    private void databind()
    {

        Grid1.DataSource = GetDataTable();
        Grid1.DataBind();
    }
    protected DataTable GetDataTable()
    {
        DataTable table = new DataTable();
        table.Columns.Add(new DataColumn("C_ID", typeof(int)));
        table.Columns.Add(new DataColumn("C_Title", typeof(String)));
        table.Columns.Add(new DataColumn("C_IsTop", typeof(String)));
        table.Columns.Add(new DataColumn("AtSchool", typeof(bool)));
        table.Columns.Add(new DataColumn("C_State", typeof(String)));
        table.Columns.Add(new DataColumn("C_Builder", typeof(int)));
        table.Columns.Add(new DataColumn("C_PublishDate", typeof(int)));
        table.Columns.Add(new DataColumn("C_UpdateDate", typeof(DateTime)));
        table.Columns.Add(new DataColumn("Desc", typeof(string)));
        table.Columns.Add(new DataColumn("Guid", typeof(Guid)));
        
        DataRow row = table.NewRow();

        row[0] = 101;
        row[1] = "陈萍萍";
        row[2] = "2000";
        row[3] = true;
        row[4] = "计算机应用技术";
        row[5] = 1;
        row[6] = 0;
        row[7] = DateTime.Now.AddDays(-100);
        row[8] = "陈萍萍，女，20岁，出生于中国南方的一个小山村，毕业于中国科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);

        row = table.NewRow();
        row[0] = 102;
        row[1] = "胡飞";
        row[2] = "2008";
        row[3] = false;
        row[4] = "信息工程";
        row[5] = 1;
        row[6] = 1;
        row[7] = DateTime.Now.AddDays(-90);
        row[8] = "胡飞，男，20岁，出生于中国北方的一个小山村，毕业于南方科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);

        row = table.NewRow();
        row[0] = 103;
        row[1] = "金婷婷";
        row[2] = "2001";
        row[3] = true;
        row[4] = "会计学";
        row[5] = 2;
        row[6] = 0;
        row[7] = DateTime.Now.AddDays(-80);
        row[8] = "金婷婷，女，28岁，出生于中国海南岛的一个小山村，毕业于中国科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);


        row = table.NewRow();
        row[0] = 104;
        row[1] = "潘国";
        row[2] = "2008";
        row[3] = false;
        row[4] = "国际经济与贸易";
        row[5] = 2;
        row[6] = 1;
        row[7] = DateTime.Now.AddDays(-70);
        row[8] = "潘国，男，22岁，出生于中国澳门的一个小山村，毕业于中国科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);


        row = table.NewRow();
        row[0] = 105;
        row[1] = "吴颖颖";
        row[2] = "2002";
        row[3] = true;
        row[4] = "市场营销";
        row[5] = 3;
        row[6] = 0;
        row[7] = DateTime.Now.AddDays(-60);
        row[8] = "吴颖颖，女，26岁，出生于中国福建的一个小山村，毕业于香港科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);


        row = table.NewRow();
        row[0] = 106;
        row[1] = "张博";
        row[2] = "2003";
        row[3] = false;
        row[4] = "财务管理";
        row[5] = 3;
        row[6] = 1;
        row[7] = DateTime.Now.AddDays(-50);
        row[8] = "张博，男，28岁，出生于中国浙江的一个小山村，毕业于电子科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);


        row = table.NewRow();
        row[0] = 107;
        row[1] = "杨倩倩";
        row[2] = "2000";
        row[3] = true;
        row[4] = "材料物理与化学";
        row[5] = 4;
        row[6] = 0;
        row[7] = DateTime.Now.AddDays(-40);
        row[8] = "杨倩倩，女，25岁，出生于中国北方的一个小山村，毕业于北京科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);


        row = table.NewRow();
        row[0] = 108;
        row[1] = "董超";
        row[2] = "2004";
        row[3] = false;
        row[4] = "生物医学工程";
        row[5] = 4;
        row[6] = 1;
        row[7] = DateTime.Now.AddDays(-30);
        row[8] = "董超，男，26岁，出生于中国河南的一个小山村，毕业于中国科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);


        row = table.NewRow();
        row[0] = 109;
        row[1] = "张娟娟";
        row[2] = "2003";
        row[3] = true;
        row[4] = "土木工程";
        row[5] = 5;
        row[6] = 0;
        row[7] = DateTime.Now.AddDays(-20);
        row[8] = "张娟娟，女，25岁，出生于中国广西的一个小山村，毕业于南方科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);

        row = table.NewRow();
        row[0] = 110;
        row[1] = "叶鹏";
        row[2] = "2006";
        row[3] = false;
        row[4] = "电子商务";
        row[5] = 5;
        row[6] = 1;
        row[7] = DateTime.Now.AddDays(-10);
        row[8] = "叶鹏，男，23岁，出生于中国安徽的一个小山村，毕业于国防科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);

        row = table.NewRow();
        row[0] = 111;
        row[1] = "李玲玲";
        row[2] = "2002";
        row[3] = true;
        row[4] = "管理学";
        row[5] = 5;
        row[6] = 0;
        row[7] = DateTime.Now.AddDays(-5);
        row[8] = "李玲玲，女，22岁，出生于中国台湾的一个小山村，毕业于台湾科学技术大学。";
        row[9] = new Guid();
        table.Rows.Add(row);


        return table;
    }
    protected void WinAdd(object sender,EventArgs e)
    {
        WinADD.Hidden = false;
    }
    protected void Grid1_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e)
    {
        Grid1.PageIndex = e.NewPageIndex;
    }
    protected void Grid1_Sort(object sender, ExtAspNet.GridSortEventArgs e)
    {
        DataTable table = GetDataTable();

        DataView view1 = table.DefaultView;
        view1.Sort = String.Format("{0} {1}", e.SortField, e.SortDirection);

        Grid1.DataSource = view1;
        Grid1.DataBind();
    }
}